package com.smart.speaker.util;

import com.alibaba.dashscope.tools.ToolBase;
import com.smart.speaker.websocket.tool.Tool;
import org.springframework.context.ApplicationContext;

import java.util.List;

public class ToolUtils {

    private static List<ToolBase> DEFAULT_TOOL_LIST;
    private static List<ToolBase> GAME_TOOL_LIST;

    public static void init(ApplicationContext applicationContext) {
        DEFAULT_TOOL_LIST = List.of(
                applicationContext.getBean("get_current_time", Tool.class).getFunction(),
                applicationContext.getBean("get_current_date", Tool.class).getFunction(),
                applicationContext.getBean("get_current_weather", Tool.class).getFunction(),
                applicationContext.getBean("game_word_tool", Tool.class).getFunction()
        );
        GAME_TOOL_LIST = List.of(
                applicationContext.getBean("exit_game_tool", Tool.class).getFunction()
        );
    }

    public static List<ToolBase> getDefaultToolList() {
        return DEFAULT_TOOL_LIST;
    }

    public static List<ToolBase> getGameToolList() {
        return GAME_TOOL_LIST;
    }
}
